import React from 'react';
import { Upload, message, Button, Icon } from 'antd';
import VortexUpload from './VortexUpload/VortexUpload';

const testUrl = `http://192.168.1.21:9091/cloudFile/common/uploadFile?documentDomain=${document.domain}`;
const serverUrl = 'http://192.168.1.207:18084/cloudFile/common/uploadFile';
const proxyUrl = `http://${document.location.host}/uploadFilesProxy/`;

const TestUpload = (props)=>{
    const vtxProps = {
        action: serverUrl,
        listType: 'text',
        defaultFileList: [...props.fileList],
        onChange(info) {
            // console.log(info);
            if (info.file.status !== 'uploading') {
                console.log(info.file, info.fileList);
            }
            if (info.file.status === 'done') {
                console.log(info.file)
                message.info(`${info.file.name} file uploaded successfully`);
            } else if (info.file.status === 'error') {
                message.info(`${info.file.name} file upload failed.`);
            }
        },
        onRemove(file){
            console.log('remove')
        }
    };
    return (
        <VortexUpload {...vtxProps}>
            <Button>
                <Icon type="upload" /> upload
            </Button>
        </VortexUpload>
    )
}

export default TestUpload;